      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
          <ol class="breadcrumb">
            <li><a href="<?=site_url()?>/product/index">商品管理</a></li>
            <li class="active">拆分商品列表</li>
          </ol>
          <div class="row margin-bottom-5">
            <div class="col-md-12">
              <ul class="nav nav-pills">
                <li class="active"><a href="<?=site_url()?>/product/adddivide">添加拆分商品</a></li>
              </ul>          
            </div>
            <hr />
          </div> 
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                <h4 class="margin-bottom-15">拆分商品列表</h4>
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>箱类商品名称</th>
                      <th>单份商品名称</th>
                      <th>数量</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<?php foreach ($divides as $item):?>
                    <tr>
                      <td><?php echo $item['id'];?></td>
                      <td><?php echo $item['name1'].'-'.$item['description1'];?></td>
                      <td><?php echo $item['name2'].'-'.$item['description2'];?></td>
                      <td><?php echo $item['amount'];?></td>
                      <td>
                     	<a href="<?php echo site_url('product/editdivide/id/'.$item['id'])?>" class="btn btn-default">编辑</a>
                     	<a href="#" class="btn btn-link del" data-id="<?php echo $item['id'];?>" >删除</a>
                      </td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
           <div class="pagination">
           		<?php echo $links ;?>
           </div>
        </div>
      </div>
    <script>
	$(document).ready(function() {
		$(".del").click(function() {
			if(confirm("确定要删除该数据吗？"))
			{
			var id = $(this).attr("data-id");
			$.ajax({
				url : '<?php echo site_url('product/deletedivide')?>',
				type : "post",
				async : true,
				data : {
					'id' : id
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						alert(data.msg);
						window.location.reload();
					}else{
						alert(data.msg);
					}
				}
			});
			}
		});
	}); 
</script>